//
//  GuideTableViewController.m
//  CoreUser
//
//  Created by Demi on 11/04/2017.
//  Copyright © 2017 Azazie. All rights reserved.
//

#import "GuideTableViewController.h"
#import "SignInViewController.h"
#import "ForgotPasswordViewController.h"
#import "SignInOrSignUpViewController.h"
#import "FacebookLogInEmailViewController.h"
#import "FacebookLoginPasswordViewController.h"
#import "CoreUser.h"

@interface GuideTableViewController ()

@end

@implementation GuideTableViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"r"];
    
    if (!cell)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"r"];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }
    
    if (indexPath.row == 0)
    {
        cell.textLabel.text = @"Sign In";
    }
    else if (indexPath.row == 1)
    {
        cell.textLabel.text = @"Sign Up";
    }
//    else if (indexPath.row == 1)
//    {
//        cell.textLabel.text = @"Forgot Password";
//    }
    else if (indexPath.row == 2)
    {
        cell.textLabel.text = @"Facebook password";
    }
    else if (indexPath.row == 3)
    {
        cell.textLabel.text = @"Facebook email";
    }
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//    if (indexPath.row == 0)
//    {
//        SignInOrSignUpViewController *vc = [[SignInOrSignUpViewController alloc] init];
//        [self.navigationController pushViewController:vc animated:YES];
//    }
//    else if (indexPath.row == 1)
//    {
//        ForgotPasswordViewController *vc = [[ForgotPasswordViewController alloc] initWithNibName:nil bundle:nil];
//        [self.navigationController pushViewController:vc animated:YES];
//    }
    if (indexPath.row == 0)
    {
        [CoreUserManager loginFromViewController:self];
    }
    else if (indexPath.row == 1)
    {
        [CoreUserManager registerFromViewController:self];
    }
    else if (indexPath.row == 2)
    {
        UIViewController *vc = [[FacebookLoginPasswordViewController alloc] initWithFacebookAccessToken:@"abc" email:@"fuli@tetx.com"];
        [self.navigationController pushViewController:vc animated:YES];
    }
    else if (indexPath.row == 3)
    {
        UIViewController *vc = [[FacebookLogInEmailViewController alloc] initWithFacebookAccessToken:@"abc"];
        [self.navigationController pushViewController:vc animated:YES];
    }
}

@end
